Module ModErrors
    Public Sub DisplayErrors(ByVal lex As Exception)
        Try
            Beep()

            Dim frms As String = ""
            Dim fm As Form
            For Each fm In Application.OpenForms
                frms += fm.Text & vbCrLf
            Next
            Dim f As New frmErrorDisplay
            Dim sError As String = _
                    "Message          : " & lex.Message & vbCrLf & _
                    "Source           : " & lex.Source & vbCrLf & _
                    "************************************************************************************************************************" & vbCrLf & _
                    "User             : " & CurrentUser & vbCrLf & _
                    "Database         : " & CurrentDB & vbCrLf & _
                    "PublishVersion   : " & GetMyPublishVersion() & vbCrLf & _
                    "Product Version  : " & Application.ProductVersion & vbCrLf & _
                    "BaseException    : " & lex.GetBaseException.Source & vbCrLf & _
                    "StackTrace       : " & lex.StackTrace & vbCrLf & _
                    "StartupPath      : " & Application.StartupPath & vbCrLf & _
                    "UserAppDataPath  : " & Application.UserAppDataPath & vbCrLf & _
                    "OpenForms        : " & frms
            If EventLog.Exists(Application.ProductName) Then
                EventLog.WriteEntry(Application.ProductName, sError, EventLogEntryType.Error)
            Else
                EventLog.CreateEventSource(Application.ProductName, Application.ProductName)
                EventLog.WriteEntry(Application.ProductName, sError, EventLogEntryType.Error)
            End If
            f.txtError.Text = sError
            f.StartPosition = FormStartPosition.CenterScreen
            f.ShowDialog()

        Catch ex As Exception

        End Try
    End Sub

    Public Sub RaiseQuestion()
        Try
            Beep()

            Dim frms As String = ""
            Dim fm As Form
            For Each fm In Application.OpenForms
                frms += fm.Text & vbCrLf
            Next
            Dim f As New frmErrorDisplay
            Dim sError As String = _
                    "User             : " & CurrentUser & vbCrLf & _
                    "Database         : " & CurrentDB & vbCrLf & _
                    "Product Version  : " & Application.ProductVersion & vbCrLf & _
                    "PublishVersion   : " & GetMyPublishVersion() & vbCrLf & _
                    "StartupPath      : " & Application.StartupPath & vbCrLf & _
                    "UserAppDataPath  : " & Application.UserAppDataPath & vbCrLf & _
                    "OpenForms        : " & frms
            If EventLog.Exists(Application.ProductName) Then
                EventLog.WriteEntry(Application.ProductName, sError, EventLogEntryType.Error)
            Else
                EventLog.CreateEventSource(Application.ProductName, Application.ProductName)
                EventLog.WriteEntry(Application.ProductName, sError, EventLogEntryType.Error)
            End If
            f.Text = "Raise Support Question"
            f.txtError.Text = sError
            f.StartPosition = FormStartPosition.CenterScreen
            f.ShowDialog()

        Catch ex As Exception

        End Try
    End Sub
End Module
